package org.example.base;

import java.util.concurrent.CopyOnWriteArrayList;

public class FailSafeTest {


    public static void main(String[] args) throws NoSuchFieldException {
        CopyOnWriteArrayList<Integer> a = new CopyOnWriteArrayList<Integer>();
        a.add(1);
        a.add(2);
        a.add(3);

        for (Integer i : a) {
            System.out.println("i = " + i);
            a.add(4);
        }

        for (Integer j : a) {
            System.out.println("j = " + j);
        }

    }
}
